const http = require('http');

const server = http.createServer((request, response) => {
    //判断 解构赋值
    let {url, method} = request;
    //设置响应头信息 Content-Type
    response.setHeader('Content-Type','text/html;charset=utf-8');
    if(url === '/login' && method === 'GET'){
        response.end('登录页面');
    }else if(url === '/register' && method === 'GET'){
        response.end('注册页面');
    }else {
        response.end('<h1>404 Not Found</h1>');
    }
});

server.listen(80, () => {
    console.log('服务已经启动.....');
})